<?
$branch = 'trunk';
$dir = null;
$workdir = getcwd();
$vars = array();
$vars['misc.odhelper.dir.config'] = $confdir = __DIR__;
define('__HOME__', $_ENV['HOME']);
define('__DIR__', __DIR__);

$configYaml = array(
    '.config.yaml',
    __HOME__ . '/.odhelper.config.yaml',
    __DIR__ . '/config.yaml',
);
$buildYaml = array(
    '.build.yaml',
    __HOME__ . '/.odhelper.build.yaml',
    __DIR__ . '/build.yaml'
);

$ver = '20110391.120';
$mode = '';
$show_notset = false;
$svn2file = false;
$fake = false;
$quite = false;

function readYaml($conf, $override = false){
    $res = array();
    for($i = sizeof($conf); --$i >= 0;){
        echo "Reading config: ${conf[$i]}";
        if(file_exists($conf[$i])){
            $tmp = Spyc::YAMLLoad($conf[$i]);
            if(array_key_exists('config-reset', $tmp) && $tmp['config-reset'] == true){
                $res = array();
                unset($tmp['config-reset']);
            }
            $res = $override ? array_merge($res, $tmp) : array_merge_recursive($res, $tmp);
            echo "\n";
        } else echo " (skip, file not exists)\n";
    }
    echo "\n";
    return $res;
}